package week01

// 206. 反转链表
// https://leetcode-cn.com/problems/reverse-linked-list/

func reverseList(head *ListNode) *ListNode {
	var last *ListNode
	for head != nil {
		next := head.Next
		head.Next = last
		last = head
		head = next
	}
	return last
}

type ListNode struct {
	Val int
	Next *ListNode
}